package main

import (
	"fmt"
	"net/http"
	_ "net/http/pprof"
)

func main() {
	http.HandleFunc("/", welcome)	//设置函数的请求路径
	http.ListenAndServe("localhost:8081", nil)		//进行监听,如果有人访问http://localhost:8081，就计入welcome函数
	fmt.Println("服务已启动") //此行代码不执行,上面代码一直在监听localhost:8081端口
}
func welcome(res http.ResponseWriter, req *http.Request) {		//放入响应对象，请求对象
	res.Header().Set("Content-Type","text/html;charset=utf-8")
	fmt.Fprintln(res, "Hello World Golang Web<b>,哈哈</b>")		//响应输出流
}
